import { type baseListInfo } from '@/page/types/base/baseList'

export interface deptInfo {
  /**
   * Id 生成策略为UUID
   */
  id: string

  /**
   * 是否删除 一般默认不删除 false
   */
  status: number

  /**
   * 创建时间 填充策略为插入自动填充
   */
  createTime: string
  /**
   * 父菜单ID
   */
  pid: string

  /**
   * 祖级列表
   */
  ancestors: number

  /**
   * 部门名称
   */
  deptName: string

  /**
   * 图片
   */
  deptImages: string

  /**
   * 显示顺序
   */
  orderNum: number

  /**
   * 负责人
   */
  leaderName: string
  /**
   * 联系电话
   */
  phone: string

  /**
   * 邮箱
   */
  email: string
  /**
   * 是否能用
   */
  work: boolean

  allDept: number[]

  companyId: string | null

  companyName: string
}

export interface deptSeachInfo {
  /**
   * 公司名称
   */
  companyName: string

  /**
   * 部门名称
   */
  deptName: string

  /**
   * 负责人
   */
  leaderName: string
  /**
   * 联系电话
   */
  phone: string
}

export interface selectDeptInfo {
  id: string
  pid: string
  deptName: string
  children: selectDeptInfo[]
}

export class deptClass {
  dialogAddCompany = false
  roles = {
    companyId: [
      {
        required: true,
        message: '公司不能为空',
        trigger: 'blur'
      }
    ],
    deptName: [
      {
        required: true,
        message: '部门名称不能为空',
        trigger: 'blur'
      }
    ],
    leader: [
      {
        required: true,
        message: '负责人不能为空',
        trigger: 'blur'
      }
    ],
    deptImages: [
      {
        required: true,
        message: '图片名称不能为空',
        trigger: 'blur'
      }
    ],
    orderNum: [
      {
        required: true,
        message: '排序不能为空',
        trigger: 'blur'
      }
    ],
    phone: [
      {
        required: true,
        message: '电话不能为空',
        trigger: 'blur'
      }
    ],
    email: [
      {
        required: true,
        message: '邮件不能为空',
        trigger: 'blur'
      }
    ]
  }

  detpS: deptSeachInfo = {
    deptName: '',
    leaderName: '',
    phone: '',
    companyName: ''
  }

  selectDept: selectDeptInfo = {
    id: '',
    pid: '',
    deptName: '',
    children: []
  }

  selectDeptTree = [] as selectDeptInfo[]
  props = {
    label: 'deptName',
    value: 'id',
    children: 'children',
    checkStrictly: true,
    emitPath: false
  }

  deptI: deptInfo = {
    id: 0,
    status: 0,
    createTime: '',
    pid: 0,
    ancestors: 0,
    deptName: '',
    deptImages: '',
    orderNum: 0,
    leaderName: '',
    phone: '',
    email: '',
    work: false,
    allDept: [],
    companyId: null,
    companyName: ''
  }

  addDept: deptInfo = {
    id: '',
    status: 1,
    createTime: '',
    pid: '',
    ancestors: 0,
    deptName: '',
    deptImages: '',
    orderNum: 0,
    leaderName: '',
    phone: '',
    email: '',
    work: false,
    allDept: [],
    companyId: null,
    companyName: ''
  }

  tableData = [] as deptInfo[]
  selectCompanyData = [] as baseListInfo[]
}
